/*
 * UFS Device
 * Based on JESD220E
 *
 * SPDX-FileCopyrightText: 2023 AMD
 * SPDX-FileContributor: Author: Sai Pavan Boddu <sai.pavan.boddu@amd.com>
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */
#ifndef UFS_DEV_DESC_H
#define UFS_DEV_DESC_H

#include "hw/block/ufs-dev.h"

#define UFS_REG_W_1(regs, feild, val) \
        regs[feild] = (uint8_t) val;
#define UFS_REG_W_2(regs, feild, val) \
        (*(uint16_t *)&regs[feild] = cpu_to_be16((uint16_t)val))
#define UFS_REG_W_4(regs, feild, val) \
        (*(uint32_t *)&regs[feild] = cpu_to_be32((uint32_t)val))
#define UFS_REG_W_8(regs, feild, val) \
        (*(uint64_t *)&regs[feild] = cpu_to_be64((uint64_t)val))
#define UFS_REG_W_N(regs, feild, val, size)    \
        do {                                   \
            switch (size) {                    \
            case 1:                            \
                UFS_REG_W_1(regs, feild, val); \
                break;                         \
            case 2:                            \
                UFS_REG_W_2(regs, feild, val); \
                break;                         \
            case 4:                            \
                UFS_REG_W_4(regs, feild, val); \
                break;                         \
            case 8:                            \
                UFS_REG_W_8(regs, feild, val); \
                break;                         \
            };                                 \
        } while (0)
#define UFS_REG_W(regs, feild, val) \
        UFS_REG_W_N(((uint8_t *)regs), feild, val, feild ## _SIZE)

#define UFS_REG_R_1(regs, feild) \
        (*(regs + feild))
#define UFS_REG_R_2(regs, feild) \
        be16_to_cpu(*(uint16_t *)(regs + feild))
#define UFS_REG_R_4(regs, feild) \
        be32_to_cpu(*(uint32_t *)(regs + feild))
#define UFS_REG_R_8(regs, feild) \
        be64_to_cpu(*(uint64_t *) (regs + feild))
#define UFS_REG_R_N(regs, feild, size)         \
        (size == 1 ? UFS_REG_R_1(regs, feild) : \
         size == 2 ? UFS_REG_R_2(regs, feild) : \
         size == 4 ? UFS_REG_R_4(regs, feild) : \
         size == 8 ? UFS_REG_R_8(regs, feild) : 0)
#define UFS_REG_R(regs, feild) \
       UFS_REG_R_N(((uint8_t *) regs), feild, feild ## _SIZE)

/*
 * DEVICE DESCRIPTOR
 */
#define DEV_LENGTH 0X00
#define DEV_LENGTH_SIZE 1
#define DEV_DESCRIPTOR_IDN 0X01
#define DEV_DESCRIPTOR_IDN_SIZE 1
#define DEV_DEVICE 0X02
#define DEV_DEVICE_SIZE 1
#define DEV_DEVICE_CLASS 0X03
#define DEV_DEVICE_CLASS_SIZE 1
#define DEV_DEVICE_SUB_CLASS 0X04
#define DEV_DEVICE_SUB_CLASS_SIZE 1
#define DEV_PROTOCOL 0X05
#define DEV_PROTOCOL_SIZE 1
#define DEV_NUMBER_LU 0X06
#define DEV_NUMBER_LU_SIZE 1
#define DEV_NUMBER_WLU 0X07
#define DEV_NUMBER_WLU_SIZE 1
#define DEV_BOOT_ENABLE 0X08
#define DEV_BOOT_ENABLE_SIZE 1
#define DEV_DESCR_ACCESS_EN 0X09
#define DEV_DESCR_ACCESS_EN_SIZE 1
#define DEV_INIT_POWER_MODE 0X0A
#define DEV_INIT_POWER_MODE_SIZE 1
#define DEV_HIGH_PRIORITY_LUN 0X0B
#define DEV_HIGH_PRIORITY_LUN_SIZE 1
#define DEV_SECURE_REMOVAL_TYPE 0X0C
#define DEV_SECURE_REMOVAL_TYPE_SIZE 1
#define DEV_SECURITY_LU 0X0D
#define DEV_SECURITY_LU_SIZE 1
#define DEV_BACKGROUND_OPS_TERM_LAT 0X0E
#define DEV_BACKGROUND_OPS_TERM_LAT_SIZE 1
#define DEV_INIT_ACTIVE_ICCLEVEL 0X0F
#define DEV_INIT_ACTIVE_ICCLEVEL_SIZE 1
#define DEV_SPEC_VERSION 0X10
#define DEV_SPEC_VERSION_SIZE 2
#define DEV_MANUFACTURE_DATE 0X12
#define DEV_MANUFACTURE_DATE_SIZE 2
#define DEV_MANUFACTURER_NAME 0X14
#define DEV_MANUFACTURER_NAME_SIZE 1
#define DEV_PRODUCT_NAME 0X15
#define DEV_PRODUCT_NAME_SIZE 1
#define DEV_SERIAL_NUMBER 0X16
#define DEV_SERIAL_NUMBER_SIZE 1
#define DEV_OEM_ID 0X17
#define DEV_OEM_ID_SIZE 1
#define DEV_MANUFACTURER_ID 0X18
#define DEV_MANUFACTURER_ID_SIZE 2
#define DEV_UD0BASE_OFFSET 0X1A
#define DEV_UD0BASE_OFFSET_SIZE 1
#define DEV_UDCONFIG_PLENGTH 0X1B
#define DEV_UDCONFIG_PLENGTH_SIZE 1
#define DEV_DEVICE_RTTCAP 0X1C
#define DEV_DEVICE_RTTCAP_SIZE 1
#define DEV_PERIODIC_RTCUPDATE 0X1D
#define DEV_PERIODIC_RTCUPDATE_SIZE 2
#define DEV_UFSFEATURES_SUPPORT 0X1F
#define DEV_UFSFEATURES_SUPPORT_SIZE 1
#define DEV_FFUTIMEOUT 0X20
#define DEV_FFUTIMEOUT_SIZE 1
#define DEV_QUEUE_DEPTH 0X21
#define DEV_QUEUE_DEPTH_SIZE 1
#define DEV_DEVICE_VERSION 0X22
#define DEV_DEVICE_VERSION_SIZE 2
#define DEV_NUM_SECURE_WPAREA 0X24
#define DEV_NUM_SECURE_WPAREA_SIZE 1
#define DEV_PSAMAX_DATA_SIZE 0X25
#define DEV_PSAMAX_DATA_SIZE_SIZE 4
#define DEV_PSASTATE_TIMEOUT 0X29
#define DEV_PSASTATE_TIMEOUT_SIZE 1
#define DEV_PRODUCT_REVISION_LEVEL 0X2A
#define DEV_PRODUCT_REVISION_LEVEL_SIZE 1
#define DEV_EXTENDED_UFSFEATURES_SUPPORT 0X4F
#define DEV_EXTENDED_UFSFEATURES_SUPPORT_SIZE 4
#define DEV_WRITE_BOOSTER_BUFFER_PRESERVE_USER_SPACE_EN 0X53
#define DEV_WRITE_BOOSTER_BUFFER_PRESERVE_USER_SPACE_EN_SIZE 1
#define DEV_WRITE_BOOSTER_BUFFER_TYPE 0X54
#define DEV_WRITE_BOOSTER_BUFFER_TYPE_SIZE 1
#define DEV_NUM_SHARED_WRITE_BOOSTER_BUFFER_ALLOC_UNITS 0X55
#define DEV_NUM_SHARED_WRITE_BOOSTER_BUFFER_ALLOC_UNITS_SIZE 4



/*
 * Configuration Descriptor
 */
#define CONFIG_LENGTH  0x00
#define CONFIG_LENGTH_SIZE 1
#define CONFIG_DESCRIPTOR_IDN  0x01
#define CONFIG_DESCRIPTOR_IDN_SIZE 1
#define CONFIG_CONF_DESC_CONTINUE  0x02
#define CONFIG_CONF_DESC_CONTINUE_SIZE 1
#define CONFIG_BOOT_ENABLE  0x03
#define CONFIG_BOOT_ENABLE_SIZE 1
#define CONFIG_DESCR_ACCESS_EN  0x04
#define CONFIG_DESCR_ACCESS_EN_SIZE 1
#define CONFIG_INIT_POWER_MODE  0x05
#define CONFIG_INIT_POWER_MODE_SIZE 1
#define CONFIG_HIGH_PRIORITY_LUN  0x06
#define CONFIG_HIGH_PRIORITY_LUN_SIZE 1
#define CONFIG_SECURE_REMOVAL_TYPE  0x07
#define CONFIG_SECURE_REMOVAL_TYPE_SIZE 1
#define CONFIG_INIT_ACTIVE_ICCLEVEL  0x08
#define CONFIG_INIT_ACTIVE_ICCLEVEL_SIZE 1
#define CONFIG_PERIODIC_RTCUPDATE  0x09
#define CONFIG_PERIODIC_RTCUPDATE_SIZE 2
#define CONFIG_RPMBREGION_ENABLE  0x0C
#define CONFIG_RPMBREGION_ENABLE_SIZE 1
#define CONFIG_RPMBREGION_1_SIZE  0x0D
#define CONFIG_RPMBREGION_1_SIZE_SIZE 1
#define CONFIG_RPMBREGION_2_SIZE  0x0E
#define CONFIG_RPMBREGION_2_SIZE_SIZE 1
#define CONFIG_RPMBREGION_3_SIZE  0x0F
#define CONFIG_RPMBREGION_3_SIZE_SIZE 1
#define CONFIG_WRITE_BOOSTER_BUFFER_PRESERVE_USER_SPACE_ENV  0x10
#define CONFIG_WRITE_BOOSTER_BUFFER_PRESERVE_USER_SPACE_ENV_SIZE 1
#define CONFIG_WRITE_BOOSTER_BUFFER_TYPE  0x11
#define CONFIG_WRITE_BOOSTER_BUFFER_TYPE_SIZE 1
#define CONFIG_NUM_SHARED_WRITE_BOOSTER_BUFFER_ALLOC_UNITS  0x12
#define CONFIG_NUM_SHARED_WRITE_BOOSTER_BUFFER_ALLOC_UNITS_SIZE 4
/*
 * Unit descriptor Configuration
 */
#define CONFIG_LU_ENABLE 0x00
#define CONFIG_LU_ENABLE_SIZE 1
#define CONFIG_BOOT_LUN_ID 0x01
#define CONFIG_BOOT_LUN_ID_SIZE 1
#define CONFIG_LU_WRITE_PROTECT 0x02
#define CONFIG_LU_WRITE_PROTECT_SIZE 1
#define CONFIG_MEMORY_TYPE 0x03
#define CONFIG_MEMORY_TYPE_SIZE 1
#define CONFIG_NUM_ALLOC_UNITS 0x04
#define CONFIG_NUM_ALLOC_UNITS_SIZE 4
#define CONFIG_DATA_RELIABILITY 0x08
#define CONFIG_DATA_RELIABILITY_SIZE 1
#define CONFIG_LOGICAL_BLOCK_SIZE 0x09
#define CONFIG_LOGICAL_BLOCK_SIZE_SIZE 1
#define CONFIG_PROVISIONING_TYPE 0x0A
#define CONFIG_PROVISIONING_TYPE_SIZE 1
#define CONFIG_CONTEXT_CAPABILITIES 0x0B
#define CONFIG_CONTEXT_CAPABILITIES_SIZE 2
#define CONFIG_LU_NUM_WRITE_BOOSTER_BUFFER_ALLOC_UNITS 0x16
#define CONFIG_LU_NUM_WRITE_BOOSTER_BUFFER_ALLOC_UNITS_SIZE 4

/*
 * Geometry Descriptor
 */
#define GOME_LENGTH  0x00
#define GOME_LENGTH_SIZE 1
#define GOME_DESCRIPTOR_IDN  0x01
#define GOME_DESCRIPTOR_IDN_SIZE 1
#define GOME_MEDIA_TECHNOLOGY  0x02
#define GOME_MEDIA_TECHNOLOGY_SIZE 1
#define GOME_TOTAL_RAW_DEVICE_CAPACITY  0x04
#define GOME_TOTAL_RAW_DEVICE_CAPACITY_SIZE 8
#define GOME_MAX_NUMBER_LU  0x0C
#define GOME_MAX_NUMBER_LU_SIZE 1
#define GOME_SEGMENT_SIZE  0x0D
#define GOME_SEGMENT_SIZE_SIZE 4
#define GOME_ALLOCATION_UNIT_SIZE  0x11
#define GOME_ALLOCATION_UNIT_SIZE_SIZE 1
#define GOME_MIN_ADDR_BLOCK_SIZE  0x12
#define GOME_MIN_ADDR_BLOCK_SIZE_SIZE 1
#define GOME_OPTIMAL_READ_BLOCK_SIZE  0x13
#define GOME_OPTIMAL_READ_BLOCK_SIZE_SIZE 1
#define GOME_OPTIMAL_WRITE_BLOCK_SIZE  0x14
#define GOME_OPTIMAL_WRITE_BLOCK_SIZE_SIZE 1
#define GOME_MAX_IN_BUFFER_SIZE  0x15
#define GOME_MAX_IN_BUFFER_SIZE_SIZE 1
#define GOME_MAX_OUT_BUFFER_SIZE  0x16
#define GOME_MAX_OUT_BUFFER_SIZE_SIZE 1
#define GOME_RPMB_READ_WRITE_SIZE  0x17
#define GOME_RPMB_READ_WRITE_SIZE_SIZE 1
#define GOME_DYNAMIC_CAPACITY_RESOURCE_POLICY  0x18
#define GOME_DYNAMIC_CAPACITY_RESOURCE_POLICY_SIZE 1
#define GOME_DATA_ORDERING  0x19
#define GOME_DATA_ORDERING_SIZE 1
#define GOME_MAX_CONTEX_IDNUMBER  0x1A
#define GOME_MAX_CONTEX_IDNUMBER_SIZE 1
#define GOME_SYS_DATA_TAG_UNIT_SIZE  0x1B
#define GOME_SYS_DATA_TAG_UNIT_SIZE_SIZE 1
#define GOME_SYS_DATA_TAG_RES_SIZE  0x1C
#define GOME_SYS_DATA_TAG_RES_SIZE_SIZE 1
#define GOME_SUPPORTED_SEC_RTYPES  0x1D
#define GOME_SUPPORTED_SEC_RTYPES_SIZE 1
#define GOME_SUPPORTED_MEMORY_TYPES  0x1E
#define GOME_SUPPORTED_MEMORY_TYPES_SIZE 2
#define GOME_SYSTEM_CODE_MAX_NALLOC_U  0x20
#define GOME_SYSTEM_CODE_MAX_NALLOC_U_SIZE 4
#define GOME_SYSTEM_CODE_CAP_ADJ_FAC  0x24
#define GOME_SYSTEM_CODE_CAP_ADJ_FAC_SIZE 2
#define GOME_NON_PERSIST_MAX_NALLOC_U  0x26
#define GOME_NON_PERSIST_MAX_NALLOC_U_SIZE 4
#define GOME_NON_PERSIST_CAP_ADJ_FAC  0x2A
#define GOME_NON_PERSIST_CAP_ADJ_FAC_SIZE 2
#define GOME_ENHANCE_1_MAX_NALLOC_U  0x2C
#define GOME_ENHANCE_1_MAX_NALLOC_U_SIZE 4
#define GOME_ENHANCE_1_CAP_ADJ_FAC  0x30
#define GOME_ENHANCE_1_CAP_ADJ_FAC_SIZE 2
#define GOME_ENHANCE_2_MAX_NALLOC_U  0x32
#define GOME_ENHANCE_2_MAX_NALLOC_U_SIZE 4
#define GOME_ENHANCE_2_CAP_ADJ_FAC  0x36
#define GOME_ENHANCE_2_CAP_ADJ_FAC_SIZE 2
#define GOME_ENHANCE_3_MAX_NALLOC_U  0x38
#define GOME_ENHANCE_3_MAX_NALLOC_U_SIZE 4
#define GOME_ENHANCE_3_CAP_ADJ_FAC  0x3C
#define GOME_ENHANCE_3_CAP_ADJ_FAC_SIZE 2
#define GOME_ENHANCE_4_MAX_NALLOC_U  0x3E
#define GOME_ENHANCE_4_MAX_NALLOC_U_SIZE 4
#define GOME_ENHANCE_4_CAP_ADJ_FAC  0x42
#define GOME_ENHANCE_4_CAP_ADJ_FAC_SIZE 2
#define GOME_OPTIMAL_LOGICAL_BLOCK_SIZE  0x44
#define GOME_OPTIMAL_LOGICAL_BLOCK_SIZE_SIZE 4
#define GOME_WRITE_BOOSTER_BUFFER_MAX_NALLOC_UNITS  0x4F
#define GOME_WRITE_BOOSTER_BUFFER_MAX_NALLOC_UNITS_SIZE 4
#define GOME_DEVICE_MAX_WRITE_BOOSTER_LUS  0x53
#define GOME_DEVICE_MAX_WRITE_BOOSTER_LUS_SIZE 1
#define GOME_WRITE_BOOSTER_BUFFER_CAP_A_DJ_FAC  0x54
#define GOME_WRITE_BOOSTER_BUFFER_CAP_A_DJ_FAC_SIZE 1
#define GOME_SUPPORTED_WRITE_BOOSTER_BUFFER_USER_SPACE_REDUCTION_TYPES  0x55
#define GOME_SUPPORTED_WRITE_BOOSTER_BUFFER_USER_SPACE_REDUCTION_TYPES_SIZE 1
#define GOME_SUPPORTED_WRITE_BOOSTER_BUFFER_TYPES  0x56
#define GOME_SUPPORTED_WRITE_BOOSTER_BUFFER_TYPES_SIZE 1

/*
 * Unit Descriptor
 */
#define UNIT_LENGTH 0x00
#define UNIT_LENGTH_SIZE 1
#define UNIT_DESCRIPTOR_IDN 0x01
#define UNIT_DESCRIPTOR_IDN_SIZE 1
#define UNIT_UNIT_INDEX 0x02
#define UNIT_UNIT_INDEX_SIZE 1
#define UNIT_LU_ENABLE 0x03
#define UNIT_LU_ENABLE_SIZE 1
#define UNIT_BOOT_LUN_ID 0x04
#define UNIT_BOOT_LUN_ID_SIZE 1
#define UNIT_LU_WRITE_PROTECT 0x05
#define UNIT_LU_WRITE_PROTECT_SIZE 1
#define UNIT_LU_QUEUE_DEPTH 0x06
#define UNIT_LU_QUEUE_DEPTH_SIZE 1
#define UNIT_PSASENSITIVE 0x07
#define UNIT_PSASENSITIVE_SIZE 1
#define UNIT_MEMORY_TYPE 0x08
#define UNIT_MEMORY_TYPE_SIZE 1
#define UNIT_DATA_RELIABILITY 0x09
#define UNIT_DATA_RELIABILITY_SIZE 1
#define UNIT_LOGICAL_BLOCK_SIZE 0x0A
#define UNIT_LOGICAL_BLOCK_SIZE_SIZE 1
#define UNIT_LOGICAL_BLOCK_COUNT 0x0B
#define UNIT_LOGICAL_BLOCK_COUNT_SIZE 8
#define UNIT_ERASE_BLOCK_SIZE 0x13
#define UNIT_ERASE_BLOCK_SIZE_SIZE 4
#define UNIT_PROVISIONING_TYPE 0x17
#define UNIT_PROVISIONING_TYPE_SIZE 1
#define UNIT_PHY_MEM_RESOURCE_COUNT 0x18
#define UNIT_PHY_MEM_RESOURCE_COUNT_SIZE 8
#define UNIT_CONTEXT_CAPABILITIES 0x20
#define UNIT_CONTEXT_CAPABILITIES_SIZE 2
#define UNIT_LARGE_UNIT_GRANULARITY_M3 0x22
#define UNIT_LARGE_UNIT_GRANULARITY_M3_SIZE 1
#define UNIT_LUNUM_WRITE_BOOSTER_BUFFER_ALLOC_UNITS 0x29
#define UNIT_LUNUM_WRITE_BOOSTER_BUFFER_ALLOC_UNITS_SIZE 4

/*
 * Interconnect Descriptor
 */

#define INTERCONNECT_LENGTH 0x0
#define INTERCONNECT_LENGTH_SIZE 1
#define INTERCONNECT_DESCRIPTOR_IDN 0x1
#define INTERCONNECT_DESCRIPTOR_IDN_SIZE 1
#define INTERCONNECT_BCD_UNIPRO_VERSION 0x2
#define INTERCONNECT_BCD_UNIPRO_VERSION_SIZE 2
#define INTERCONNECT_BCD_MPHY_VERSION 0x4
#define INTERCONNECT_BCD_MPHY_VERSION_SIZE 0x2

/*
 * Device Health Descriptor
 */
#define DEV_HEALTH_LENGTH 0x0
#define DEV_HEALTH_LENGTH_SIZE 1
#define DEV_HEALTH_DESCRIPTOR_IDN 0x1
#define DEV_HEALTH_DESCRIPTOR_IDN_SIZE 1
#define DEV_HEALTH_PRE_EOLINFO 0x2
#define DEV_HEALTH_PRE_EOLINFO_SIZE 1
#define DEV_HEALTH_DEVICE_LIFE_TIME_EST_A 0x3
#define DEV_HEALTH_DEVICE_LIFE_TIME_EST_A_SIZE 1
#define DEV_HEALTH_DEVICE_LIFE_TIME_EST_B 0x4
#define DEV_HEALTH_DEVICE_LIFE_TIME_EST_B_SIZE 1
#define DEV_HEALTH_VENDOR_PROP_INFO 0x5
#define DEV_HEALTH_VENDOR_PROP_INFO_SIZE 32
#define DEV_HEALTH_REFRESH_TOTAL_COUNT 0x25
#define DEV_HEALTH_REFRESH_TOTAL_COUNT_SIZE 4
#define DEV_HEALTH_REFRESH_PROGRESS 0x29
#define DEV_HEALTH_REFRESH_PROGRESS_SIZE 4

/*
 * Attributes
 */
#define ATTR_BOOT_LUN_EN 0x00
#define ATTR_BOOT_LUN_EN_SIZE 0x1
#define ATTR_CURRENT_POWER_MODE 0x02
#define ATTR_CURRENT_POWER_MODE_SIZE 0x1
#define ATTR_ACTIVE_LEVEL 0x03
#define ATTR_ACTIVE_LEVEL_SIZE 0x1
#define ATTR_OUT_OF_ORDER_DATA_EN 0x04
#define ATTR_OUT_OF_ORDER_DATA_EN_SIZE 0x1
#define ATTR_BACKGROUND_OP_STATUS 0x05
#define ATTR_BACKGROUND_OP_STATUS_SIZE 0x1
#define ATTR_PURGE_STATUS 0x06
#define ATTR_PURGE_STATUS_SIZE 0x1
#define ATTR_MAX_DATA_IN_SIZE 0x07
#define ATTR_MAX_DATA_IN_SIZE_SIZE 0x1
#define ATTR_MAX_DATA_OUT_SIZE 0x08
#define ATTR_MAX_DATA_OUT_SIZE_SIZE 0x1
#define ATTR_DYN_CAP_NEEDED 0x09
#define ATTR_DYN_CAP_NEEDED_SIZE 0x4
#define ATTR_REF_CLK_FREQ 0x0A
#define ATTR_REF_CLK_FREQ_SIZE 0x1
#define ATTR_CONFIG_DESCR_LOCK 0x0B
#define ATTR_CONFIG_DESCR_LOCK_SIZE 0x1
#define ATTR_MAX_NUM_OF_T 0x0C
#define ATTR_MAX_NUM_OF_T_SIZE 0x1
#define ATTR_EXCEPTION_EVENT_CONTROL 0x0D
#define ATTR_EXCEPTION_EVENT_CONTROL_SIZE 0x2
#define ATTR_EXCEPTION_EVENT_STATUS 0x0E
#define ATTR_EXCEPTION_EVENT_STATUS_SIZE 0x2
#define ATTR_SECONDS_PASSED 0x0F
#define ATTR_SECONDS_PASSED_SIZE 0x4
#define ATTR_CONTEXT_CONF 0x10
#define ATTR_CONTEXT_CONF_SIZE 0x2
#define ATTR_DEVICE_STATUS 0x14
#define ATTR_DEVICE_STATUS_SIZE 0x1
#define ATTR_STATE 0x15
#define ATTR_STATE_SIZE 0x1
#define ATTR_DATA_SIZE 0x16
#define ATTR_DATA_SIZE_SIZE 0x4
#define ATTR_REF_CLK_GATING_WAIT_TIME 0x17
#define ATTR_REF_CLK_GATING_WAIT_TIME_SIZE 0x1
#define ATTR_DEVICE_CASE_ROUGH_TEMPERAURE 0x18
#define ATTR_DEVICE_CASE_ROUGH_TEMPERAURE_SIZE 0x1
#define ATTR_DEVICE_TOO_HIGH_TEMP_BOUNDARY 0x19
#define ATTR_DEVICE_TOO_HIGH_TEMP_BOUNDARY_SIZE 0x1
#define ATTR_DEVICE_TOO_LOW_TEMP_BOUNDARY 0x1A
#define ATTR_DEVICE_TOO_LOW_TEMP_BOUNDARY_SIZE 0x1
#define ATTR_THROTTLING_STATUS 0x1B
#define ATTR_THROTTLING_STATUS_SIZE 0x1
#define ATTR_WRITE_BOOSTER_BUFFER_FLUSH_STATUS 0x1C
#define ATTR_WRITE_BOOSTER_BUFFER_FLUSH_STATUS_SIZE 0x1
#define ATTR_AVAILABLE_WRITE_BOOSTER_BUFFER_SIZE 0x1D
#define ATTR_AVAILABLE_WRITE_BOOSTER_BUFFER_SIZE_SIZE 0x1
#define ATTR_WRITE_BOOSTER_BUFFER_LIFE_TIME_EST 0x1E
#define ATTR_WRITE_BOOSTER_BUFFER_LIFE_TIME_EST_SIZE 0x1
#define ATTR_CURRENT_WRITE_BOOSTER_BUFFER_SIZE 0x1F
#define ATTR_CURRENT_WRITE_BOOSTER_BUFFER_SIZE_SIZE 0x4
#define ATTR_REFRESH_STATUS 0x2C
#define ATTR_REFRESH_STATUS_SIZE 0x1
#define ATTR_REFRESH_FREQ 0x2D
#define ATTR_REFRESH_FREQ_SIZE 0x1
#define ATTR_REFRESH_UNIT 0x2E
#define ATTR_REFRESH_UNIT_SIZE 0x1
#define ATTR_REFRESH_METHOD 0x2F
#define ATTR_REFRESH_METHOD_SIZE 0x1

/*
 * Flags
 */
#define FLAG_DEVICE_INIT 0x01
#define FLAG_PERMANENT_WPEN 0x02
#define FLAG_POWER_ON_WPEN 0x03
#define FLAG_BACKGROUND_OPS_EN 0x04
#define FLAG_DEVICE_LIFE_SPAN_MODE_EN 0x05
#define FLAG_PURGE_ENABLE 0x06
#define FLAG_REFRESH_ENABLE 0x07
#define FLAG_PHY_RESOURCE_REMOVAL 0x08
#define FLAG_BUSY_RTC 0x09
#define FLAG_PERMANENTLY_DISABLE_FW_UPDATE 0x0B
#define FLAG_WRITE_BOOSTER_EN 0x0E
#define FLAG_WRITE_BOOSTER_BUFFER_FLUSH_EN 0x0F
#define FLAG_WRITE_BOOSTER_BUFFER_FLUSH_DURING_HIBERNATE 0x10

#endif
